package com.yanqu.road.server.cmd.smallgame;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.smallgame.SmallGameProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.smallgame.SmallGameModule;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_SMALLGAME_CHALLENGE_REPEAT_CHALLENGE,desc = "小游戏重复挑战")
public class SmallGameChallengeReplayCmd extends AbstractCommand {

    private int type;

    private int stageId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        SmallGameProto.RepeatChallengeReqMsg reqMsg = SmallGameProto.RepeatChallengeReqMsg.parseFrom(packet.getBytes());
        type = reqMsg.getType();
        stageId = reqMsg.getStageId();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        player.getModule(SmallGameModule.class).rePlaySmallGame(type, stageId);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
